
<?php

$id=intval($_POST['id']);
$url=$_POST['url'];
$limit=intval($_POST['limit']);
$num=intval($_POST['num']);
$next=intval($_POST['next']);
$per=intval($_POST['per']);

$rm=$num-$limit;
if($rm<$next){
	$data=comment($id,$url,$limit,$rm);
	
}else{
	$data=comment($id,$url,$limit,$next);
	$limit2=$limit+$next;
}

			 
					
													if($data[data])
													foreach($data[data] as $row)
													{
														
														?>
			<div class="media " style="border-bottom:1px  dotted #CCC">
			
					  <div class="media-body">
										 <div ><span style="font-size:10px">	<em><i class="icon-user"></i> <?php  if($row['lv']==1){?><span class="label label-important"> <?php echo $row['user']; ?></span><?php }else{?> <?php echo $row['user']; ?><?php }?>  /  <i class="icon-time"></i> <?php echo $row['time_add'];?></em></span> </div>
											<?php echo $row['content'];?>
										 <br />
									<div  style="text-align:right;; padding-bottom:5px">
										  <a class="btn  btn-small  btn-warning "  href="javascript:quote('<?php echo $row['user'];?>',<?php echo $row['id']?>)" ><i class="icon-comment icon-white"></i> Reply</a>
										  <?php
											if($per==1 || $per==2)
													{
													?>
										  <a class="btn btn-small  btn-warning"    href="javascript:delete_comment(<?php echo $row['id']?>,<?php echo $id;?>,'<?php  echo $url;?>')"><i class="icon-remove  icon-white"></i> Delete</a>
										  <?php
													}?>
									</div>
							  
										
													  <?php
										   if($row['reply']==1){
											   ?>   		<div  style="border-bottom: 1px dashed #999">&nbsp;</div>
												   <?php
											foreach($row['replydata'] as $rc){
											?>
												<!-- SubComment -->
												<div class="media">
												<blockquote>
																<div><span style="font-size:10px">	<em></em></span></div>
																 <?php echo $rc['content']; ?>
																 <small><i class="icon-user"></i><?php  if($rc['lv']==1){?><span class="label label-important"> <?php echo $rc['user']; ?></span><?php }else{?> <?php echo $rc['user']; ?><?php }?> /  <i class="icon-time"></i><?php echo $rc['time_add']; ?></small>
																 
																  <br />       <?php
																	if($per==1 || $per==2)
																	{
																	?>
																						 <div  style="text-align:right">
																						   <a class="btn btn-small  btn-warning" href="javascript:delete_comment(<?php echo $rc['id']?>,<?php echo $id;?>,'<?php  echo $url;?>')"><i class="icon-remove  icon-white"></i> Delete</a>
																						</div>
																	<?php
																	}
																 ?>
														</blockquote>         
												</div><!-- End of SubComment -->
												  <?php }?>
												
												<?php
										   }?> <!-- ROW REPLY =1 -->
											
					  </div><!-- End of  Media-body main comment -->
			</div><!-- End of  Main Media -->
			
			
			
			
			<?php }?>

<?php
if($rm>$next){?>

<div id="morecm"  name="morcecm">
<input type="hidden" id="comment_per"  name="comment_per" value="<?php  echo $per;?>"/>
<input type="hidden" id="comment_limit"  name="comment_limit" value="<?php  echo $limit2;?>"/>
<input type="hidden"  id="comment_num" name="comment_num" value="<?php  echo $num;?>"/>
<input type="hidden"  id="comment_next" name="comment_next" value="<?php  echo $next ;?>"/>
<a  onclick="loadmore_comment()" class="btn btn-small btn-block btn-warning" id="morebt" name="morebt"><strong>View More</strong></a>
</div>
<?php
}

exit();
?>
